package com.newmainsoftech.dao.entity;

public interface EntityIdentifier {
	/**
	 * Getter of this <code>&#x40;Entity</code> identifier value.<br />
	 * 
	 * @return value of <code>&#x40;Entity</code> identifier.
	 */
	String getId();
	/**
	 * Getter of the version value of this <code>&#x40;Entity</code> instance.<br />
	 * 
	 * @return version value of <code>&#x40;Entity</code> instance.
	 */
	Long getVersion();
	/**
	 * Indicate whether this <code>&#x40;Entity</code> instance has been persisted to datastore.<br />
	 * 
	 * @return boolean value indicating whether this <code>&#x40;Entity</code> instance has been 
	 * persisted to datastore.
	 */
	boolean isPersisted();
	
	/**
	 * Substitute of <code>equals</code> method to include attribute values beside key ID value (what 
	 * is obtained with <code>{@link #getId()}</code> method) too in comparison, when <code>equals</code> 
	 * method compares only key ID values.<br />
	 * Whether including key ID value in comparison or not is implementation specific.<br />
	 * 
	 * @param obj Possibly another instance of <code>{@link EntityIdentifier}</code> type.
	 * @return 0 when 2 objects are considered as identical, negative value when obj is considered as 
	 * bigger or obj should come later, positive value when obj is considered as smaller or should come 
	 * earlier.
	 * @see EntityIdentifierComparator#compare(EntityIdentifier, EntityIdentifier)
	 */
	int comp( Object obj);
}
